﻿using System;
using System.Windows.Data;

namespace CPN.PJN.Silverlight.Extensions.Converters
{
    /// <summary>
    /// Négation de la valeur
    /// </summary>
    public class NegateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value is bool)
            {
                return !(bool)value;
            }

            return null;
        }
    }
}
